<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>module Minitest::Assertions - minitest: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="module">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-diff">::diff</a>
    <li ><a href="#method-c-diff-3D">::diff=</a>
    <li ><a href="#method-i-assert">#assert</a>
    <li ><a href="#method-i-assert_empty">#assert_empty</a>
    <li ><a href="#method-i-assert_equal">#assert_equal</a>
    <li ><a href="#method-i-assert_in_delta">#assert_in_delta</a>
    <li ><a href="#method-i-assert_in_epsilon">#assert_in_epsilon</a>
    <li ><a href="#method-i-assert_includes">#assert_includes</a>
    <li ><a href="#method-i-assert_instance_of">#assert_instance_of</a>
    <li ><a href="#method-i-assert_kind_of">#assert_kind_of</a>
    <li ><a href="#method-i-assert_match">#assert_match</a>
    <li ><a href="#method-i-assert_mock">#assert_mock</a>
    <li ><a href="#method-i-assert_nil">#assert_nil</a>
    <li ><a href="#method-i-assert_operator">#assert_operator</a>
    <li ><a href="#method-i-assert_output">#assert_output</a>
    <li ><a href="#method-i-assert_path_exists">#assert_path_exists</a>
    <li ><a href="#method-i-assert_pattern">#assert_pattern</a>
    <li ><a href="#method-i-assert_predicate">#assert_predicate</a>
    <li ><a href="#method-i-assert_raises">#assert_raises</a>
    <li ><a href="#method-i-assert_respond_to">#assert_respond_to</a>
    <li ><a href="#method-i-assert_same">#assert_same</a>
    <li ><a href="#method-i-assert_send">#assert_send</a>
    <li ><a href="#method-i-assert_silent">#assert_silent</a>
    <li ><a href="#method-i-assert_throws">#assert_throws</a>
    <li ><a href="#method-i-capture_io">#capture_io</a>
    <li ><a href="#method-i-capture_subprocess_io">#capture_subprocess_io</a>
    <li ><a href="#method-i-diff">#diff</a>
    <li ><a href="#method-i-exception_details">#exception_details</a>
    <li ><a href="#method-i-fail_after">#fail_after</a>
    <li ><a href="#method-i-flunk">#flunk</a>
    <li ><a href="#method-i-message">#message</a>
    <li ><a href="#method-i-mu_pp">#mu_pp</a>
    <li ><a href="#method-i-mu_pp_for_diff">#mu_pp_for_diff</a>
    <li ><a href="#method-i-pass">#pass</a>
    <li ><a href="#method-i-refute">#refute</a>
    <li ><a href="#method-i-refute_empty">#refute_empty</a>
    <li ><a href="#method-i-refute_equal">#refute_equal</a>
    <li ><a href="#method-i-refute_in_delta">#refute_in_delta</a>
    <li ><a href="#method-i-refute_in_epsilon">#refute_in_epsilon</a>
    <li ><a href="#method-i-refute_includes">#refute_includes</a>
    <li ><a href="#method-i-refute_instance_of">#refute_instance_of</a>
    <li ><a href="#method-i-refute_kind_of">#refute_kind_of</a>
    <li ><a href="#method-i-refute_match">#refute_match</a>
    <li ><a href="#method-i-refute_nil">#refute_nil</a>
    <li ><a href="#method-i-refute_operator">#refute_operator</a>
    <li ><a href="#method-i-refute_path_exists">#refute_path_exists</a>
    <li ><a href="#method-i-refute_pattern">#refute_pattern</a>
    <li ><a href="#method-i-refute_predicate">#refute_predicate</a>
    <li ><a href="#method-i-refute_respond_to">#refute_respond_to</a>
    <li ><a href="#method-i-refute_same">#refute_same</a>
    <li ><a href="#method-i-skip">#skip</a>
    <li ><a href="#method-i-skip_until">#skip_until</a>
    <li ><a href="#method-i-skipped-3F">#skipped?</a>
    <li ><a href="#method-i-things_to_diff">#things_to_diff</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="module-Minitest::Assertions">
    <h1 id="module-Minitest::Assertions" class="module">
      module Minitest::Assertions
    </h1>

    <section class="description">
    
<p><a href="../Minitest.html"><code>Minitest</code></a> <a href="Assertions.html"><code>Assertions</code></a>.  All assertion methods accept a <code>msg</code> which is printed if the assertion fails.</p>

<p>Protocol: Nearly everything here boils up to <code>assert</code>, which expects to be able to increment an instance accessor named <code>assertions</code>. This is not provided by <a href="Assertions.html"><code>Assertions</code></a> and must be provided by the thing including <a href="Assertions.html"><code>Assertions</code></a>. See Minitest::Runnable for an example.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">





                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-diff" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">diff</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the diff command to use in <a href="Assertions.html#method-i-diff"><code>diff</code></a>. Tries to intelligently figure out what diff to use.</p>

                              <div class="method-source-code" id="diff-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 29</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">diff</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@diff</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span> <span class="ruby-ivar">@diff</span>

  <span class="ruby-ivar">@diff</span> = <span class="ruby-keyword">if</span> (<span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-string">&quot;host_os&quot;</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp">/mswin|mingw/</span> <span class="ruby-operator">&amp;&amp;</span>
              <span class="ruby-identifier">system</span>(<span class="ruby-string">&quot;diff.exe&quot;</span>, <span class="ruby-keyword">__FILE__</span>, <span class="ruby-keyword">__FILE__</span>)) <span class="ruby-keyword">then</span>
            <span class="ruby-string">&quot;diff.exe -u&quot;</span>
          <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">system</span>(<span class="ruby-string">&quot;gdiff&quot;</span>, <span class="ruby-keyword">__FILE__</span>, <span class="ruby-keyword">__FILE__</span>)
            <span class="ruby-string">&quot;gdiff -u&quot;</span> <span class="ruby-comment"># solaris and kin suck</span>
          <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">system</span>(<span class="ruby-string">&quot;diff&quot;</span>, <span class="ruby-keyword">__FILE__</span>, <span class="ruby-keyword">__FILE__</span>)
            <span class="ruby-string">&quot;diff -u&quot;</span>
          <span class="ruby-keyword">else</span>
            <span class="ruby-keyword">nil</span>
          <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-diff-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">diff=</span><span
                                class="method-args">(o)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set the diff command to use in <a href="Assertions.html#method-i-diff"><code>diff</code></a>.</p>

                              <div class="method-source-code" id="diff-3D-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 47</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">diff=</span> <span class="ruby-identifier">o</span>
  <span class="ruby-ivar">@diff</span> = <span class="ruby-identifier">o</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-assert" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert</span><span
                                class="method-args">(test, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless <code>test</code> is truthy.</p>

                              <div class="method-source-code" id="assert-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 178</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert</span> <span class="ruby-identifier">test</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">assertions</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">test</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">msg</span> <span class="ruby-operator">||=</span> <span class="ruby-node">&quot;Expected #{mu_pp test} to be truthy.&quot;</span>
    <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Proc</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">msg</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">Minitest</span><span class="ruby-operator">::</span><span class="ruby-constant">Assertion</span>, <span class="ruby-identifier">msg</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_empty" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_empty</span><span
                                class="method-args">(obj, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless <code>obj</code> is empty.</p>

                              <div class="method-source-code" id="assert_empty-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 195</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_empty</span> <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected #{mu_pp(obj)} to be empty&quot;</span> }
  <span class="ruby-identifier">assert_respond_to</span> <span class="ruby-identifier">obj</span>, <span class="ruby-value">:empty?</span>
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">empty?</span>, <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_equal" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_equal</span><span
                                class="method-args">(exp, act, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless <code>exp == act</code> printing the difference between the two, if possible.</p>

<p>If there is no visible difference but the assertion fails, you should suspect that your == is buggy, or your inspect output is missing crucial details.  For nicer structural diffing, set <a href="Test.html#method-c-make_my_diffs_pretty-21"><code>Minitest::Test.make_my_diffs_pretty!</code></a></p>

<p>For floats use assert_in_delta.</p>

<p>See also: <a href="Assertions.html#method-c-diff"><code>Minitest::Assertions.diff</code></a></p>

                              <div class="method-source-code" id="assert_equal-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 216</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_equal</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">act</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-constant">E</span>) { <span class="ruby-identifier">diff</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">act</span> }
  <span class="ruby-identifier">result</span> = <span class="ruby-identifier">assert</span> <span class="ruby-identifier">exp</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">act</span>, <span class="ruby-identifier">msg</span>

  <span class="ruby-keyword">if</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">exp</span> <span class="ruby-keyword">then</span>
    <span class="ruby-keyword">if</span> <span class="ruby-constant">Minitest</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^6/</span> <span class="ruby-keyword">then</span>
      <span class="ruby-identifier">refute_nil</span> <span class="ruby-identifier">exp</span>, <span class="ruby-string">&quot;Use assert_nil if expecting nil.&quot;</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">where</span> = <span class="ruby-constant">Minitest</span>.<span class="ruby-identifier">filter_backtrace</span>(<span class="ruby-identifier">caller</span>).<span class="ruby-identifier">first</span>
      <span class="ruby-identifier">where</span> = <span class="ruby-identifier">where</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/:in /</span>, <span class="ruby-value">2</span>).<span class="ruby-identifier">first</span> <span class="ruby-comment"># clean up noise</span>

      <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;DEPRECATED: Use assert_nil if expecting nil from #{where}. This will fail in Minitest 6.&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">result</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_in_delta" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_in_delta</span><span
                                class="method-args">(exp, act, delta = 0.001, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>For comparing Floats.  Fails unless <code>exp</code> and <code>act</code> are within <code>delta</code> of each other.</p>

<pre class="ruby"><span class="ruby-identifier">assert_in_delta</span> <span class="ruby-constant">Math</span><span class="ruby-operator">::</span><span class="ruby-constant">PI</span>, (<span class="ruby-value">22.0</span> <span class="ruby-operator">/</span> <span class="ruby-value">7.0</span>), <span class="ruby-value">0.01</span>
</pre>

                              <div class="method-source-code" id="assert_in_delta-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 240</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_in_delta</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">act</span>, <span class="ruby-identifier">delta</span> = <span class="ruby-value">0.001</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">n</span> = (<span class="ruby-identifier">exp</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">act</span>).<span class="ruby-identifier">abs</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) {
    <span class="ruby-node">&quot;Expected |#{exp} - #{act}| (#{n}) to be &lt;= #{delta}&quot;</span>
  }
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">delta</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">n</span>, <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_in_epsilon" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_in_epsilon</span><span
                                class="method-args">(exp, act, epsilon = 0.001, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>For comparing Floats.  Fails unless <code>exp</code> and <code>act</code> have a relative error less than <code>epsilon</code>.</p>

                              <div class="method-source-code" id="assert_in_epsilon-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 252</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_in_epsilon</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">act</span>, <span class="ruby-identifier">epsilon</span> = <span class="ruby-value">0.001</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">assert_in_delta</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">act</span>, [<span class="ruby-identifier">exp</span>.<span class="ruby-identifier">abs</span>, <span class="ruby-identifier">act</span>.<span class="ruby-identifier">abs</span>].<span class="ruby-identifier">min</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">epsilon</span>, <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_includes" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_includes</span><span
                                class="method-args">(collection, obj, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless <code>collection</code> includes <code>obj</code>.</p>

                              <div class="method-source-code" id="assert_includes-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 259</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_includes</span> <span class="ruby-identifier">collection</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) {
    <span class="ruby-node">&quot;Expected #{mu_pp(collection)} to include #{mu_pp(obj)}&quot;</span>
  }
  <span class="ruby-identifier">assert_respond_to</span> <span class="ruby-identifier">collection</span>, <span class="ruby-value">:include?</span>
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">obj</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_instance_of" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_instance_of</span><span
                                class="method-args">(cls, obj, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless <code>obj</code> is an instance of <code>cls</code>.</p>

                              <div class="method-source-code" id="assert_instance_of-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 270</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_instance_of</span> <span class="ruby-identifier">cls</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) {
    <span class="ruby-node">&quot;Expected #{mu_pp(obj)} to be an instance of #{cls}, not #{obj.class}&quot;</span>
  }

  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-identifier">cls</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_kind_of" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_kind_of</span><span
                                class="method-args">(cls, obj, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless <code>obj</code> is a kind of <code>cls</code>.</p>

                              <div class="method-source-code" id="assert_kind_of-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 281</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_kind_of</span> <span class="ruby-identifier">cls</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) {
    <span class="ruby-node">&quot;Expected #{mu_pp(obj)} to be a kind of #{cls}, not #{obj.class}&quot;</span> }

  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-identifier">cls</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_match" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_match</span><span
                                class="method-args">(matcher, obj, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless <code>matcher</code> <code>=~</code> <code>obj</code>.</p>

                              <div class="method-source-code" id="assert_match-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 291</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_match</span> <span class="ruby-identifier">matcher</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected #{mu_pp matcher} to match #{mu_pp obj}&quot;</span> }
  <span class="ruby-identifier">assert_respond_to</span> <span class="ruby-identifier">matcher</span>, <span class="ruby-value">:&quot;=~&quot;</span>
  <span class="ruby-identifier">matcher</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span> <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span> <span class="ruby-identifier">matcher</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">String</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">matcher</span>
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">matcher</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span>

  <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_mock" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_mock</span><span
                                class="method-args">(mock)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Assert that the mock verifies correctly.</p>

                              <div class="method-source-code" id="assert_mock-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/mock.rb, line 248</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_mock</span> <span class="ruby-identifier">mock</span>
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">mock</span>.<span class="ruby-identifier">verify</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_nil" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_nil</span><span
                                class="method-args">(obj, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless <code>obj</code> is nil</p>

                              <div class="method-source-code" id="assert_nil-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 303</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_nil</span> <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected #{mu_pp(obj)} to be nil&quot;</span> }
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">nil?</span>, <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_operator" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_operator</span><span
                                class="method-args">(o1, op, o2 = UNDEFINED, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>For testing with binary operators. Eg:</p>

<pre class="ruby"><span class="ruby-identifier">assert_operator</span> <span class="ruby-value">5</span>, <span class="ruby-value">:&lt;=</span>, <span class="ruby-value">4</span>
</pre>

                              <div class="method-source-code" id="assert_operator-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 313</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_operator</span> <span class="ruby-identifier">o1</span>, <span class="ruby-identifier">op</span>, <span class="ruby-identifier">o2</span> = <span class="ruby-constant">UNDEFINED</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">assert_predicate</span> <span class="ruby-identifier">o1</span>, <span class="ruby-identifier">op</span>, <span class="ruby-identifier">msg</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">UNDEFINED</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">o2</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected #{mu_pp(o1)} to be #{op} #{mu_pp(o2)}&quot;</span> }
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">o1</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">op</span>, <span class="ruby-identifier">o2</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_output" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_output</span><span
                                class="method-args">(stdout = nil, stderr = nil) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if stdout or stderr do not output the expected results. Pass in nil if you don’t care about that streams output. Pass in “” if you require it to be silent. Pass in a regexp if you want to pattern match.</p>

<pre class="ruby"><span class="ruby-identifier">assert_output</span>(<span class="ruby-regexp">/hey/</span>) { <span class="ruby-identifier">method_with_output</span> }
</pre>

<p>NOTE: this uses <a href="Assertions.html#method-i-capture_io"><code>capture_io</code></a>, not <a href="Assertions.html#method-i-capture_subprocess_io"><code>capture_subprocess_io</code></a>.</p>

<p>See also: <a href="Assertions.html#method-i-assert_silent"><code>assert_silent</code></a></p>

                              <div class="method-source-code" id="assert_output-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 331</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_output</span> <span class="ruby-identifier">stdout</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">stderr</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">flunk</span> <span class="ruby-string">&quot;assert_output requires a block to capture output.&quot;</span> <span class="ruby-keyword">unless</span>
    <span class="ruby-identifier">block_given?</span>

  <span class="ruby-identifier">out</span>, <span class="ruby-identifier">err</span> = <span class="ruby-identifier">capture_io</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">yield</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">err_msg</span> = <span class="ruby-constant">Regexp</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">stderr</span> <span class="ruby-operator">?</span> <span class="ruby-value">:assert_match</span> <span class="ruby-operator">:</span> <span class="ruby-value">:assert_equal</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">stderr</span>
  <span class="ruby-identifier">out_msg</span> = <span class="ruby-constant">Regexp</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">stdout</span> <span class="ruby-operator">?</span> <span class="ruby-value">:assert_match</span> <span class="ruby-operator">:</span> <span class="ruby-value">:assert_equal</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">stdout</span>

  <span class="ruby-identifier">y</span> = <span class="ruby-identifier">send</span> <span class="ruby-identifier">err_msg</span>, <span class="ruby-identifier">stderr</span>, <span class="ruby-identifier">err</span>, <span class="ruby-string">&quot;In stderr&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">err_msg</span>
  <span class="ruby-identifier">x</span> = <span class="ruby-identifier">send</span> <span class="ruby-identifier">out_msg</span>, <span class="ruby-identifier">stdout</span>, <span class="ruby-identifier">out</span>, <span class="ruby-string">&quot;In stdout&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">out_msg</span>

  (<span class="ruby-operator">!</span><span class="ruby-identifier">stdout</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">x</span>) <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-operator">!</span><span class="ruby-identifier">stderr</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">y</span>)
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Assertion</span>
  <span class="ruby-identifier">raise</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">UnexpectedError</span>, <span class="ruby-identifier">e</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_path_exists" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_path_exists</span><span
                                class="method-args">(path, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless <code>path</code> exists.</p>

                              <div class="method-source-code" id="assert_path_exists-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 355</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_path_exists</span> <span class="ruby-identifier">path</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected path &#39;#{path}&#39; to exist&quot;</span> }
  <span class="ruby-identifier">assert</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">path</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_pattern" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_pattern</span><span
                                class="method-args">() { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>For testing with pattern matching (only supported with Ruby 3.0 and later)</p>

<pre class="ruby"><span class="ruby-comment"># pass</span>
<span class="ruby-identifier">assert_pattern</span> { [<span class="ruby-value">1</span>,<span class="ruby-value">2</span>,<span class="ruby-value">3</span>] <span class="ruby-operator">=&gt;</span> [<span class="ruby-constant">Integer</span>, <span class="ruby-constant">Integer</span>, <span class="ruby-constant">Integer</span>] }

<span class="ruby-comment"># fail &quot;length mismatch (given 3, expected 1)&quot;</span>
<span class="ruby-identifier">assert_pattern</span> { [<span class="ruby-value">1</span>,<span class="ruby-value">2</span>,<span class="ruby-value">3</span>] <span class="ruby-operator">=&gt;</span> [<span class="ruby-constant">Integer</span>] }
</pre>

<p>The bare <code>=&gt;</code> pattern will raise a NoMatchingPatternError on failure, which would normally be counted as a test error. This assertion rescues NoMatchingPatternError and generates a test failure. Any other exception will be raised as normal and generate a test error.</p>

                              <div class="method-source-code" id="assert_pattern-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 374</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_pattern</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-string">&quot;only available in Ruby 3.0+&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">RUBY_VERSION</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-string">&quot;3.0&quot;</span>
  <span class="ruby-identifier">flunk</span> <span class="ruby-string">&quot;assert_pattern requires a block to capture errors.&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block_given?</span>

  <span class="ruby-keyword">begin</span> <span class="ruby-comment"># TODO: remove after ruby 2.6 dropped</span>
    <span class="ruby-keyword">yield</span>
    <span class="ruby-identifier">pass</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NoMatchingPatternError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
    <span class="ruby-identifier">flunk</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_predicate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_predicate</span><span
                                class="method-args">(o1, op, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>For testing with predicates. Eg:</p>

<pre class="ruby"><span class="ruby-identifier">assert_predicate</span> <span class="ruby-identifier">str</span>, <span class="ruby-value">:empty?</span>
</pre>

<p>This is really meant for specs and is front-ended by <a href="Assertions.html#method-i-assert_operator"><code>assert_operator</code></a>:</p>

<pre class="ruby"><span class="ruby-identifier">str</span>.<span class="ruby-identifier">must_be</span> <span class="ruby-value">:empty?</span>
</pre>

                              <div class="method-source-code" id="assert_predicate-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 395</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_predicate</span> <span class="ruby-identifier">o1</span>, <span class="ruby-identifier">op</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected #{mu_pp(o1)} to be #{op}&quot;</span> }
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">o1</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">op</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_raises" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_raises</span><span
                                class="method-args">(*exp) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless the block raises one of <code>exp</code>. Returns the exception matched so you can check the message, attributes, etc.</p>

<p><code>exp</code> takes an optional message on the end to help explain failures and defaults to StandardError if no exception class is passed. Eg:</p>

<pre class="ruby"><span class="ruby-identifier">assert_raises</span>(<span class="ruby-constant">CustomError</span>) { <span class="ruby-identifier">method_with_custom_error</span> }
</pre>

<p>With custom error message:</p>

<pre class="ruby"><span class="ruby-identifier">assert_raises</span>(<span class="ruby-constant">CustomError</span>, <span class="ruby-string">&#39;This should have raised CustomError&#39;</span>) { <span class="ruby-identifier">method_with_custom_error</span> }
</pre>

<p>Using the returned object:</p>

<pre class="ruby"><span class="ruby-identifier">error</span> = <span class="ruby-identifier">assert_raises</span>(<span class="ruby-constant">CustomError</span>) <span class="ruby-keyword">do</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">CustomError</span>, <span class="ruby-string">&#39;This is really bad&#39;</span>
<span class="ruby-keyword">end</span>

<span class="ruby-identifier">assert_equal</span> <span class="ruby-string">&#39;This is really bad&#39;</span>, <span class="ruby-identifier">error</span>.<span class="ruby-identifier">message</span>
</pre>

                              <div class="method-source-code" id="assert_raises-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 422</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_raises</span> <span class="ruby-operator">*</span><span class="ruby-identifier">exp</span>
  <span class="ruby-identifier">flunk</span> <span class="ruby-string">&quot;assert_raises requires a block to capture errors.&quot;</span> <span class="ruby-keyword">unless</span>
    <span class="ruby-identifier">block_given?</span>

  <span class="ruby-identifier">msg</span> = <span class="ruby-node">&quot;#{exp.pop}.\n&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">String</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">last</span>
  <span class="ruby-identifier">exp</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">StandardError</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-keyword">begin</span>
    <span class="ruby-keyword">yield</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-operator">*</span><span class="ruby-identifier">exp</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
    <span class="ruby-identifier">pass</span> <span class="ruby-comment"># count assertion</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">e</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Minitest</span><span class="ruby-operator">::</span><span class="ruby-constant">Assertion</span> <span class="ruby-comment"># incl Skip &amp; UnexpectedError</span>
    <span class="ruby-comment"># don&#39;t count assertion</span>
    <span class="ruby-identifier">raise</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">SignalException</span>, <span class="ruby-constant">SystemExit</span>
    <span class="ruby-identifier">raise</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
    <span class="ruby-identifier">flunk</span> <span class="ruby-identifier">proc</span> {
      <span class="ruby-identifier">exception_details</span>(<span class="ruby-identifier">e</span>, <span class="ruby-node">&quot;#{msg}#{mu_pp(exp)} exception expected, not&quot;</span>)
    }
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">exp</span> = <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">first</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>

  <span class="ruby-identifier">flunk</span> <span class="ruby-node">&quot;#{msg}#{mu_pp(exp)} expected but nothing was raised.&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_respond_to" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_respond_to</span><span
                                class="method-args">(obj, meth, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless <code>obj</code> responds to <code>meth</code>.</p>

                              <div class="method-source-code" id="assert_respond_to-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 453</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_respond_to</span> <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) {
    <span class="ruby-node">&quot;Expected #{mu_pp(obj)} (#{obj.class}) to respond to ##{meth}&quot;</span>
  }
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">meth</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_same" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_same</span><span
                                class="method-args">(exp, act, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless <code>exp</code> and <code>act</code> are equal?</p>

                              <div class="method-source-code" id="assert_same-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 463</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_same</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">act</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) {
    <span class="ruby-identifier">data</span> = [<span class="ruby-identifier">mu_pp</span>(<span class="ruby-identifier">act</span>), <span class="ruby-identifier">act</span>.<span class="ruby-identifier">object_id</span>, <span class="ruby-identifier">mu_pp</span>(<span class="ruby-identifier">exp</span>), <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">object_id</span>]
    <span class="ruby-string">&quot;Expected %s (oid=%d) to be the same as %s (oid=%d)&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">data</span>
  }
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">act</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_send" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_send</span><span
                                class="method-args">(send_ary, m = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><code>send_ary</code> is a receiver, message and arguments.</p>

<p>Fails unless the call returns a true value</p>

                              <div class="method-source-code" id="assert_send-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 476</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_send</span> <span class="ruby-identifier">send_ary</span>, <span class="ruby-identifier">m</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">where</span> = <span class="ruby-constant">Minitest</span>.<span class="ruby-identifier">filter_backtrace</span>(<span class="ruby-identifier">caller</span>).<span class="ruby-identifier">first</span>
  <span class="ruby-identifier">where</span> = <span class="ruby-identifier">where</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/:in /</span>, <span class="ruby-value">2</span>).<span class="ruby-identifier">first</span> <span class="ruby-comment"># clean up noise</span>
  <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;DEPRECATED: assert_send. From #{where}&quot;</span>

  <span class="ruby-identifier">recv</span>, <span class="ruby-identifier">msg</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> = <span class="ruby-identifier">send_ary</span>
  <span class="ruby-identifier">m</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">m</span>) {
    <span class="ruby-node">&quot;Expected #{mu_pp(recv)}.#{msg}(*#{mu_pp(args)}) to return true&quot;</span> }
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>), <span class="ruby-identifier">m</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_silent" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_silent</span><span
                                class="method-args">() { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if the block outputs anything to stderr or stdout.</p>

<p>See also: <a href="Assertions.html#method-i-assert_output"><code>assert_output</code></a></p>

                              <div class="method-source-code" id="assert_silent-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 492</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_silent</span>
  <span class="ruby-identifier">assert_output</span> <span class="ruby-string">&quot;&quot;</span>, <span class="ruby-string">&quot;&quot;</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">yield</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_throws" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_throws</span><span
                                class="method-args">(sym, msg = nil) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails unless the block throws <code>sym</code></p>

                              <div class="method-source-code" id="assert_throws-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 501</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_throws</span> <span class="ruby-identifier">sym</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">default</span> = <span class="ruby-node">&quot;Expected #{mu_pp(sym)} to have been thrown&quot;</span>
  <span class="ruby-identifier">caught</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-identifier">value</span> = <span class="ruby-identifier">catch</span>(<span class="ruby-identifier">sym</span>) <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-keyword">yield</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">ThreadError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>       <span class="ruby-comment"># wtf?!? 1.8 + threads == suck</span>
      <span class="ruby-identifier">default</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;, not \:#{e.message[/uncaught throw \`(\w+?)\&#39;/, 1]}&quot;</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>     <span class="ruby-comment"># 1.9 exception</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;uncaught throw&quot;</span>)
      <span class="ruby-identifier">default</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;, not #{e.message.split(/ /).last}&quot;</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NameError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>         <span class="ruby-comment"># 1.8 exception</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">sym</span>
      <span class="ruby-identifier">default</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;, not #{e.name.inspect}&quot;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">caught</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">caught</span>, <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-identifier">default</span> }
  <span class="ruby-identifier">value</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Assertion</span>
  <span class="ruby-identifier">raise</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">UnexpectedError</span>, <span class="ruby-identifier">e</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-capture_io" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">capture_io</span><span
                                class="method-args">() { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Captures $stdout and $stderr into strings:</p>

<pre class="ruby"><span class="ruby-identifier">out</span>, <span class="ruby-identifier">err</span> = <span class="ruby-identifier">capture_io</span> <span class="ruby-keyword">do</span>
  <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Some info&quot;</span>
  <span class="ruby-identifier">warn</span> <span class="ruby-string">&quot;You did a bad thing&quot;</span>
<span class="ruby-keyword">end</span>

<span class="ruby-identifier">assert_match</span> <span class="ruby-regexp">%r%info%</span>, <span class="ruby-identifier">out</span>
<span class="ruby-identifier">assert_match</span> <span class="ruby-regexp">%r%bad%</span>, <span class="ruby-identifier">err</span>
</pre>

<p>NOTE: For efficiency, this method uses StringIO and does not capture IO for subprocesses. Use <a href="Assertions.html#method-i-capture_subprocess_io"><code>capture_subprocess_io</code></a> for that.</p>

                              <div class="method-source-code" id="capture_io-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 542</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">capture_io</span>
  <span class="ruby-identifier">_synchronize</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">captured_stdout</span>, <span class="ruby-identifier">captured_stderr</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>, <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>

      <span class="ruby-identifier">orig_stdout</span>, <span class="ruby-identifier">orig_stderr</span> = <span class="ruby-identifier">$stdout</span>, <span class="ruby-identifier">$stderr</span>
      <span class="ruby-identifier">$stdout</span>, <span class="ruby-identifier">$stderr</span>         = <span class="ruby-identifier">captured_stdout</span>, <span class="ruby-identifier">captured_stderr</span>

      <span class="ruby-keyword">yield</span>

      <span class="ruby-keyword">return</span> <span class="ruby-identifier">captured_stdout</span>.<span class="ruby-identifier">string</span>, <span class="ruby-identifier">captured_stderr</span>.<span class="ruby-identifier">string</span>
    <span class="ruby-keyword">ensure</span>
      <span class="ruby-identifier">$stdout</span> = <span class="ruby-identifier">orig_stdout</span>
      <span class="ruby-identifier">$stderr</span> = <span class="ruby-identifier">orig_stderr</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-capture_subprocess_io" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">capture_subprocess_io</span><span
                                class="method-args">() { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Captures $stdout and $stderr into strings, using Tempfile to ensure that subprocess IO is captured as well.</p>

<pre class="ruby"><span class="ruby-identifier">out</span>, <span class="ruby-identifier">err</span> = <span class="ruby-identifier">capture_subprocess_io</span> <span class="ruby-keyword">do</span>
  <span class="ruby-identifier">system</span> <span class="ruby-string">&quot;echo Some info&quot;</span>
  <span class="ruby-identifier">system</span> <span class="ruby-string">&quot;echo You did a bad thing 1&gt;&amp;2&quot;</span>
<span class="ruby-keyword">end</span>

<span class="ruby-identifier">assert_match</span> <span class="ruby-regexp">%r%info%</span>, <span class="ruby-identifier">out</span>
<span class="ruby-identifier">assert_match</span> <span class="ruby-regexp">%r%bad%</span>, <span class="ruby-identifier">err</span>
</pre>

<p>NOTE: This method is approximately 10x slower than <a href="Assertions.html#method-i-capture_io"><code>capture_io</code></a> so only use it when you need to test the output of a subprocess.</p>

                              <div class="method-source-code" id="capture_subprocess_io-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 575</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">capture_subprocess_io</span>
  <span class="ruby-identifier">_synchronize</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">require</span> <span class="ruby-string">&quot;tempfile&quot;</span>

      <span class="ruby-identifier">captured_stdout</span>, <span class="ruby-identifier">captured_stderr</span> = <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;out&quot;</span>), <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;err&quot;</span>)

      <span class="ruby-identifier">orig_stdout</span>, <span class="ruby-identifier">orig_stderr</span> = <span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">dup</span>, <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">dup</span>
      <span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-identifier">captured_stdout</span>
      <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-identifier">captured_stderr</span>

      <span class="ruby-keyword">yield</span>

      <span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">rewind</span>
      <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">rewind</span>

      <span class="ruby-keyword">return</span> <span class="ruby-identifier">captured_stdout</span>.<span class="ruby-identifier">read</span>, <span class="ruby-identifier">captured_stderr</span>.<span class="ruby-identifier">read</span>
    <span class="ruby-keyword">ensure</span>
      <span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-identifier">orig_stdout</span>
      <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-identifier">orig_stderr</span>

      <span class="ruby-identifier">orig_stdout</span>.<span class="ruby-identifier">close</span>
      <span class="ruby-identifier">orig_stderr</span>.<span class="ruby-identifier">close</span>
      <span class="ruby-identifier">captured_stdout</span>.<span class="ruby-identifier">close!</span>
      <span class="ruby-identifier">captured_stderr</span>.<span class="ruby-identifier">close!</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-diff" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">diff</span><span
                                class="method-args">(exp, act)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a diff between <code>exp</code> and <code>act</code>. If there is no known diff command or if it doesn’t make sense to diff the output (single line, short output), then it simply returns a basic comparison between the two.</p>

<p>See <code>things_to_diff</code> for more info.</p>

                              <div class="method-source-code" id="diff-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 59</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">diff</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">act</span>
  <span class="ruby-identifier">result</span> = <span class="ruby-keyword">nil</span>

  <span class="ruby-identifier">expect</span>, <span class="ruby-identifier">butwas</span> = <span class="ruby-identifier">things_to_diff</span>(<span class="ruby-identifier">exp</span>, <span class="ruby-identifier">act</span>)

  <span class="ruby-keyword">return</span> <span class="ruby-node">&quot;Expected: #{mu_pp exp}\n  Actual: #{mu_pp act}&quot;</span> <span class="ruby-keyword">unless</span>
    <span class="ruby-identifier">expect</span>

  <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">open</span>(<span class="ruby-string">&quot;expect&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">a</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">expect</span>
    <span class="ruby-identifier">a</span>.<span class="ruby-identifier">flush</span>

    <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">open</span>(<span class="ruby-string">&quot;butwas&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">b</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">butwas</span>
      <span class="ruby-identifier">b</span>.<span class="ruby-identifier">flush</span>

      <span class="ruby-identifier">result</span> = <span class="ruby-node">`#{Minitest::Assertions.diff} #{a.path} #{b.path}`</span>
      <span class="ruby-identifier">result</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/^\-\-\- .+/</span>, <span class="ruby-string">&quot;--- expected&quot;</span>)
      <span class="ruby-identifier">result</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/^\+\+\+ .+/</span>, <span class="ruby-string">&quot;+++ actual&quot;</span>)

      <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword">then</span>
        <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">class</span>
        <span class="ruby-identifier">result</span> = [
                  <span class="ruby-node">&quot;No visible difference in the #{klass}#inspect output.\n&quot;</span>,
                  <span class="ruby-string">&quot;You should look at the implementation of #== on &quot;</span>,
                  <span class="ruby-node">&quot;#{klass} or its members.\n&quot;</span>,
                  <span class="ruby-identifier">expect</span>,
                 ].<span class="ruby-identifier">join</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">result</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-exception_details" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">exception_details</span><span
                                class="method-args">(e, msg)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns details for exception <code>e</code></p>

                              <div class="method-source-code" id="exception_details-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 607</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">exception_details</span> <span class="ruby-identifier">e</span>, <span class="ruby-identifier">msg</span>
  [
   <span class="ruby-node">&quot;#{msg}&quot;</span>,
   <span class="ruby-node">&quot;Class: &lt;#{e.class}&gt;&quot;</span>,
   <span class="ruby-node">&quot;Message: &lt;#{e.message.inspect}&gt;&quot;</span>,
   <span class="ruby-string">&quot;---Backtrace---&quot;</span>,
   <span class="ruby-node">&quot;#{Minitest.filter_backtrace(e.backtrace).join(&quot;\n&quot;)}&quot;</span>,
   <span class="ruby-string">&quot;---------------&quot;</span>,
  ].<span class="ruby-identifier">join</span> <span class="ruby-string">&quot;\n&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-fail_after" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">fail_after</span><span
                                class="method-args">(y,m,d,msg)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails after a given date (in the local time zone). This allows you to put time-bombs in your tests if you need to keep something around until a later date lest you forget about it.</p>

                              <div class="method-source-code" id="fail_after-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 623</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">fail_after</span> <span class="ruby-identifier">y</span>,<span class="ruby-identifier">m</span>,<span class="ruby-identifier">d</span>,<span class="ruby-identifier">msg</span>
  <span class="ruby-identifier">flunk</span> <span class="ruby-identifier">msg</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">&gt;</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-identifier">y</span>, <span class="ruby-identifier">m</span>, <span class="ruby-identifier">d</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-flunk" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">flunk</span><span
                                class="method-args">(msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails with <code>msg</code>.</p>

                              <div class="method-source-code" id="flunk-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 630</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">flunk</span> <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> <span class="ruby-operator">||=</span> <span class="ruby-string">&quot;Epic Fail!&quot;</span>
  <span class="ruby-identifier">assert</span> <span class="ruby-keyword">false</span>, <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-message" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">message</span><span
                                class="method-args">(msg = nil, ending = nil, &amp;default)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a proc that will output <code>msg</code> along with the default message.</p>

                              <div class="method-source-code" id="message-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 638</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">message</span> <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">ending</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">default</span>
  <span class="ruby-identifier">proc</span> {
    <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">call</span>.<span class="ruby-identifier">chomp</span>(<span class="ruby-string">&quot;.&quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-constant">Proc</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">msg</span>
    <span class="ruby-identifier">custom_message</span> = <span class="ruby-node">&quot;#{msg}.\n&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-node">&quot;#{custom_message}#{default.call}#{ending || &quot;.&quot;}&quot;</span>
  }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-mu_pp" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">mu_pp</span><span
                                class="method-args">(obj)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>This returns a human-readable version of <code>obj</code>. By default inspect is called. You can override this to use pretty_inspect if you want.</p>

<p>See <a href="Test.html#method-c-make_my_diffs_pretty-21"><code>Minitest::Test.make_my_diffs_pretty!</code></a></p>

                              <div class="method-source-code" id="mu_pp-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 129</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mu_pp</span> <span class="ruby-identifier">obj</span>
  <span class="ruby-identifier">s</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">inspect</span>

  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span> <span class="ruby-constant">Encoding</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">encode</span> <span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">default_external</span>

    <span class="ruby-keyword">if</span> <span class="ruby-constant">String</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">obj</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">encoding</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">default_external</span> <span class="ruby-operator">||</span>
                          <span class="ruby-operator">!</span><span class="ruby-identifier">obj</span>.<span class="ruby-identifier">valid_encoding?</span>) <span class="ruby-keyword">then</span>
      <span class="ruby-identifier">enc</span> = <span class="ruby-node">&quot;# encoding: #{obj.encoding}&quot;</span>
      <span class="ruby-identifier">val</span> = <span class="ruby-node">&quot;#    valid: #{obj.valid_encoding?}&quot;</span>
      <span class="ruby-identifier">s</span> = <span class="ruby-node">&quot;#{enc}\n#{val}\n#{s}&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">s</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-mu_pp_for_diff" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">mu_pp_for_diff</span><span
                                class="method-args">(obj)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>This returns a diff-able more human-readable version of <code>obj</code>. This differs from the regular <a href="Assertions.html#method-i-mu_pp"><code>mu_pp</code></a> because it expands escaped newlines and makes hex-values (like object_ids) generic. This uses <a href="Assertions.html#method-i-mu_pp"><code>mu_pp</code></a> to do the first pass and then cleans it up.</p>

                              <div class="method-source-code" id="mu_pp_for_diff-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 152</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mu_pp_for_diff</span> <span class="ruby-identifier">obj</span>
  <span class="ruby-identifier">str</span> = <span class="ruby-identifier">mu_pp</span> <span class="ruby-identifier">obj</span>

  <span class="ruby-comment"># both &#39;\n&#39; &amp; &#39;\\n&#39; (_after_ mu_pp (aka inspect))</span>
  <span class="ruby-identifier">single</span> = <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-identifier">str</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/(?&lt;!\\|^)\\n/</span>)
  <span class="ruby-identifier">double</span> = <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-identifier">str</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/(?&lt;=\\|^)\\n/</span>)

  <span class="ruby-identifier">process</span> =
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">single</span> <span class="ruby-operator">^</span> <span class="ruby-identifier">double</span> <span class="ruby-keyword">then</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">single</span> <span class="ruby-keyword">then</span>
        <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;\\n&quot;</span>   <span class="ruby-operator">?</span> <span class="ruby-string">&quot;\n&quot;</span>    <span class="ruby-operator">:</span> <span class="ruby-identifier">s</span> } <span class="ruby-comment"># unescape</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;\\\\n&quot;</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;\\n\n&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">s</span> } <span class="ruby-comment"># unescape a bit, add nls</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-value">:itself</span>                                     <span class="ruby-comment"># leave it alone</span>
    <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">str</span>.
    <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\\?\\n/</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">process</span>).
    <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/:0x[a-fA-F0-9]{4,}/m</span>, <span class="ruby-string">&quot;:0xXXXXXX&quot;</span>) <span class="ruby-comment"># anonymize hex values</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-pass" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">pass</span><span
                                class="method-args">(_msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>used for counting assertions</p>

                              <div class="method-source-code" id="pass-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 649</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pass</span> <span class="ruby-identifier">_msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">assert</span> <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute</span><span
                                class="method-args">(test, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if <code>test</code> is truthy.</p>

                              <div class="method-source-code" id="refute-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 656</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute</span> <span class="ruby-identifier">test</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">message</span> { <span class="ruby-node">&quot;Expected #{mu_pp(test)} to not be truthy&quot;</span> }
  <span class="ruby-identifier">assert</span> <span class="ruby-operator">!</span><span class="ruby-identifier">test</span>, <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_empty" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_empty</span><span
                                class="method-args">(obj, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if <code>obj</code> is empty.</p>

                              <div class="method-source-code" id="refute_empty-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 664</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_empty</span> <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected #{mu_pp(obj)} to not be empty&quot;</span> }
  <span class="ruby-identifier">assert_respond_to</span> <span class="ruby-identifier">obj</span>, <span class="ruby-value">:empty?</span>
  <span class="ruby-identifier">refute</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">empty?</span>, <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_equal" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_equal</span><span
                                class="method-args">(exp, act, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if <code>exp == act</code>.</p>

<p>For floats use refute_in_delta.</p>

                              <div class="method-source-code" id="refute_equal-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 675</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_equal</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">act</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) {
    <span class="ruby-node">&quot;Expected #{mu_pp(act)} to not be equal to #{mu_pp(exp)}&quot;</span>
  }
  <span class="ruby-identifier">refute</span> <span class="ruby-identifier">exp</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">act</span>, <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_in_delta" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_in_delta</span><span
                                class="method-args">(exp, act, delta = 0.001, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>For comparing Floats.  Fails if <code>exp</code> is within <code>delta</code> of <code>act</code>.</p>

<pre class="ruby"><span class="ruby-identifier">refute_in_delta</span> <span class="ruby-constant">Math</span><span class="ruby-operator">::</span><span class="ruby-constant">PI</span>, (<span class="ruby-value">22.0</span> <span class="ruby-operator">/</span> <span class="ruby-value">7.0</span>)
</pre>

                              <div class="method-source-code" id="refute_in_delta-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 687</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_in_delta</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">act</span>, <span class="ruby-identifier">delta</span> = <span class="ruby-value">0.001</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">n</span> = (<span class="ruby-identifier">exp</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">act</span>).<span class="ruby-identifier">abs</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) {
    <span class="ruby-node">&quot;Expected |#{exp} - #{act}| (#{n}) to not be &lt;= #{delta}&quot;</span>
  }
  <span class="ruby-identifier">refute</span> <span class="ruby-identifier">delta</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">n</span>, <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_in_epsilon" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_in_epsilon</span><span
                                class="method-args">(a, b, epsilon = 0.001, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>For comparing Floats.  Fails if <code>exp</code> and <code>act</code> have a relative error less than <code>epsilon</code>.</p>

                              <div class="method-source-code" id="refute_in_epsilon-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 699</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_in_epsilon</span> <span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>, <span class="ruby-identifier">epsilon</span> = <span class="ruby-value">0.001</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">refute_in_delta</span> <span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>, <span class="ruby-identifier">a</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">epsilon</span>, <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_includes" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_includes</span><span
                                class="method-args">(collection, obj, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if <code>collection</code> includes <code>obj</code>.</p>

                              <div class="method-source-code" id="refute_includes-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 706</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_includes</span> <span class="ruby-identifier">collection</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) {
    <span class="ruby-node">&quot;Expected #{mu_pp(collection)} to not include #{mu_pp(obj)}&quot;</span>
  }
  <span class="ruby-identifier">assert_respond_to</span> <span class="ruby-identifier">collection</span>, <span class="ruby-value">:include?</span>
  <span class="ruby-identifier">refute</span> <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">obj</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_instance_of" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_instance_of</span><span
                                class="method-args">(cls, obj, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if <code>obj</code> is an instance of <code>cls</code>.</p>

                              <div class="method-source-code" id="refute_instance_of-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 717</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_instance_of</span> <span class="ruby-identifier">cls</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) {
    <span class="ruby-node">&quot;Expected #{mu_pp(obj)} to not be an instance of #{cls}&quot;</span>
  }
  <span class="ruby-identifier">refute</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-identifier">cls</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_kind_of" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_kind_of</span><span
                                class="method-args">(cls, obj, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if <code>obj</code> is a kind of <code>cls</code>.</p>

                              <div class="method-source-code" id="refute_kind_of-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 727</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_kind_of</span> <span class="ruby-identifier">cls</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected #{mu_pp(obj)} to not be a kind of #{cls}&quot;</span> }
  <span class="ruby-identifier">refute</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-identifier">cls</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_match" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_match</span><span
                                class="method-args">(matcher, obj, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if <code>matcher</code> <code>=~</code> <code>obj</code>.</p>

                              <div class="method-source-code" id="refute_match-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 735</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_match</span> <span class="ruby-identifier">matcher</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected #{mu_pp matcher} to not match #{mu_pp obj}&quot;</span> }
  <span class="ruby-identifier">assert_respond_to</span> <span class="ruby-identifier">matcher</span>, <span class="ruby-value">:&quot;=~&quot;</span>
  <span class="ruby-identifier">matcher</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span> <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span> <span class="ruby-identifier">matcher</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">String</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">matcher</span>
  <span class="ruby-identifier">refute</span> <span class="ruby-identifier">matcher</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_nil" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_nil</span><span
                                class="method-args">(obj, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if <code>obj</code> is nil.</p>

                              <div class="method-source-code" id="refute_nil-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 745</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_nil</span> <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected #{mu_pp(obj)} to not be nil&quot;</span> }
  <span class="ruby-identifier">refute</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">nil?</span>, <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_operator" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_operator</span><span
                                class="method-args">(o1, op, o2 = UNDEFINED, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if <code>o1</code> is not <code>op</code> <code>o2</code>. Eg:</p>

<pre class="ruby"><span class="ruby-identifier">refute_operator</span> <span class="ruby-value">1</span>, <span class="ruby-value">:&gt;</span>, <span class="ruby-value">2</span> <span class="ruby-comment">#=&gt; pass</span>
<span class="ruby-identifier">refute_operator</span> <span class="ruby-value">1</span>, <span class="ruby-value">:&lt;</span>, <span class="ruby-value">2</span> <span class="ruby-comment">#=&gt; fail</span>
</pre>

                              <div class="method-source-code" id="refute_operator-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 780</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_operator</span> <span class="ruby-identifier">o1</span>, <span class="ruby-identifier">op</span>, <span class="ruby-identifier">o2</span> = <span class="ruby-constant">UNDEFINED</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">refute_predicate</span> <span class="ruby-identifier">o1</span>, <span class="ruby-identifier">op</span>, <span class="ruby-identifier">msg</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">UNDEFINED</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">o2</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected #{mu_pp(o1)} to not be #{op} #{mu_pp(o2)}&quot;</span> }
  <span class="ruby-identifier">refute</span> <span class="ruby-identifier">o1</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">op</span>, <span class="ruby-identifier">o2</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_path_exists" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_path_exists</span><span
                                class="method-args">(path, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if <code>path</code> exists.</p>

                              <div class="method-source-code" id="refute_path_exists-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 789</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_path_exists</span> <span class="ruby-identifier">path</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected path &#39;#{path}&#39; to not exist&quot;</span> }
  <span class="ruby-identifier">refute</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">path</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_pattern" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_pattern</span><span
                                class="method-args">() { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>For testing with pattern matching (only supported with Ruby 3.0 and later)</p>

<pre class="ruby"><span class="ruby-comment"># pass</span>
<span class="ruby-identifier">refute_pattern</span> { [<span class="ruby-value">1</span>,<span class="ruby-value">2</span>,<span class="ruby-value">3</span>] <span class="ruby-operator">=&gt;</span> [<span class="ruby-constant">String</span>] }

<span class="ruby-comment"># fail &quot;NoMatchingPatternError expected, but nothing was raised.&quot;</span>
<span class="ruby-identifier">refute_pattern</span> { [<span class="ruby-value">1</span>,<span class="ruby-value">2</span>,<span class="ruby-value">3</span>] <span class="ruby-operator">=&gt;</span> [<span class="ruby-constant">Integer</span>, <span class="ruby-constant">Integer</span>, <span class="ruby-constant">Integer</span>] }
</pre>

<p>This assertion expects a NoMatchingPatternError exception, and will fail if none is raised. Any other exceptions will be raised as normal and generate a test error.</p>

                              <div class="method-source-code" id="refute_pattern-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 762</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_pattern</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-string">&quot;only available in Ruby 3.0+&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">RUBY_VERSION</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-string">&quot;3.0&quot;</span>
  <span class="ruby-identifier">flunk</span> <span class="ruby-string">&quot;refute_pattern requires a block to capture errors.&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block_given?</span>

  <span class="ruby-keyword">begin</span>
    <span class="ruby-keyword">yield</span>
    <span class="ruby-identifier">flunk</span>(<span class="ruby-string">&quot;NoMatchingPatternError expected, but nothing was raised.&quot;</span>)
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NoMatchingPatternError</span>
    <span class="ruby-identifier">pass</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_predicate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_predicate</span><span
                                class="method-args">(o1, op, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>For testing with predicates.</p>

<pre class="ruby"><span class="ruby-identifier">refute_predicate</span> <span class="ruby-identifier">str</span>, <span class="ruby-value">:empty?</span>
</pre>

<p>This is really meant for specs and is front-ended by <a href="Assertions.html#method-i-refute_operator"><code>refute_operator</code></a>:</p>

<pre class="ruby"><span class="ruby-identifier">str</span>.<span class="ruby-identifier">wont_be</span> <span class="ruby-value">:empty?</span>
</pre>

                              <div class="method-source-code" id="refute_predicate-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 803</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_predicate</span> <span class="ruby-identifier">o1</span>, <span class="ruby-identifier">op</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected #{mu_pp(o1)} to not be #{op}&quot;</span> }
  <span class="ruby-identifier">refute</span> <span class="ruby-identifier">o1</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">op</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_respond_to" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_respond_to</span><span
                                class="method-args">(obj, meth, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if <code>obj</code> responds to the message <code>meth</code>.</p>

                              <div class="method-source-code" id="refute_respond_to-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 811</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_respond_to</span> <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) { <span class="ruby-node">&quot;Expected #{mu_pp(obj)} to not respond to #{meth}&quot;</span> }

  <span class="ruby-identifier">refute</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">meth</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_same" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute_same</span><span
                                class="method-args">(exp, act, msg = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Fails if <code>exp</code> is the same (by object identity) as <code>act</code>.</p>

                              <div class="method-source-code" id="refute_same-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 820</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute_same</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">act</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">msg</span> = <span class="ruby-identifier">message</span>(<span class="ruby-identifier">msg</span>) {
    <span class="ruby-identifier">data</span> = [<span class="ruby-identifier">mu_pp</span>(<span class="ruby-identifier">act</span>), <span class="ruby-identifier">act</span>.<span class="ruby-identifier">object_id</span>, <span class="ruby-identifier">mu_pp</span>(<span class="ruby-identifier">exp</span>), <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">object_id</span>]
    <span class="ruby-string">&quot;Expected %s (oid=%d) to not be the same as %s (oid=%d)&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">data</span>
  }
  <span class="ruby-identifier">refute</span> <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">act</span>), <span class="ruby-identifier">msg</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-skip" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">skip</span><span
                                class="method-args">(msg = nil, bt = caller)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Skips the current run. If run in verbose-mode, the skipped run gets listed at the end of the run but doesn’t cause a failure exit code.</p>

                              <div class="method-source-code" id="skip-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 833</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">skip</span> <span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">bt</span> = <span class="ruby-identifier">caller</span>
  <span class="ruby-identifier">msg</span> <span class="ruby-operator">||=</span> <span class="ruby-string">&quot;Skipped, no message given&quot;</span>
  <span class="ruby-ivar">@skip</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">Minitest</span><span class="ruby-operator">::</span><span class="ruby-constant">Skip</span>, <span class="ruby-identifier">msg</span>, <span class="ruby-identifier">bt</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-skip_until" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">skip_until</span><span
                                class="method-args">(y,m,d,msg)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Skips the current run until a given date (in the local time zone). This allows you to put some fixes on hold until a later date, but still holds you accountable and prevents you from forgetting it.</p>

                              <div class="method-source-code" id="skip_until-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 845</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">skip_until</span> <span class="ruby-identifier">y</span>,<span class="ruby-identifier">m</span>,<span class="ruby-identifier">d</span>,<span class="ruby-identifier">msg</span>
  <span class="ruby-identifier">skip</span> <span class="ruby-identifier">msg</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-identifier">y</span>, <span class="ruby-identifier">m</span>, <span class="ruby-identifier">d</span>)
  <span class="ruby-identifier">where</span> = <span class="ruby-identifier">caller</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">rpartition</span>(<span class="ruby-string">&#39;:in&#39;</span>).<span class="ruby-identifier">reject</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:empty?</span>).<span class="ruby-identifier">first</span>
  <span class="ruby-identifier">warn</span> <span class="ruby-string">&quot;Stale skip_until %p at %s&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">msg</span>, <span class="ruby-identifier">where</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-skipped-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">skipped?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Was this testcase skipped? Meant for teardown.</p>

                              <div class="method-source-code" id="skipped-3F-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 854</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">skipped?</span>
  <span class="ruby-keyword">defined?</span>(<span class="ruby-ivar">@skip</span>) <span class="ruby-keyword">and</span> <span class="ruby-ivar">@skip</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-things_to_diff" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">things_to_diff</span><span
                                class="method-args">(exp, act)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns things to diff [expect, butwas], or [nil, nil] if nothing to diff.</p>

<p>Criterion:</p>
<ol><li>
<p>Strings include newlines or escaped newlines, but not both.</p>
</li><li>
<p>or:  String lengths are &gt; 30 characters.</p>
</li><li>
<p>or:  Strings are equal to each other (but maybe different encodings?).</p>
</li><li>
<p>and: we found a diff executable.</p>
</li></ol>

                              <div class="method-source-code" id="things_to_diff-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest/assertions.rb, line 104</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">things_to_diff</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">act</span>
  <span class="ruby-identifier">expect</span> = <span class="ruby-identifier">mu_pp_for_diff</span> <span class="ruby-identifier">exp</span>
  <span class="ruby-identifier">butwas</span> = <span class="ruby-identifier">mu_pp_for_diff</span> <span class="ruby-identifier">act</span>

  <span class="ruby-identifier">e1</span>, <span class="ruby-identifier">e2</span> = <span class="ruby-identifier">expect</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;\n&quot;</span>), <span class="ruby-identifier">expect</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;\\n&quot;</span>)
  <span class="ruby-identifier">b1</span>, <span class="ruby-identifier">b2</span> = <span class="ruby-identifier">butwas</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;\n&quot;</span>), <span class="ruby-identifier">butwas</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;\\n&quot;</span>)

  <span class="ruby-identifier">need_to_diff</span> =
    (<span class="ruby-identifier">e1</span> <span class="ruby-operator">^</span> <span class="ruby-identifier">e2</span>                  <span class="ruby-operator">||</span>
     <span class="ruby-identifier">b1</span> <span class="ruby-operator">^</span> <span class="ruby-identifier">b2</span>                  <span class="ruby-operator">||</span>
     <span class="ruby-identifier">expect</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">30</span>         <span class="ruby-operator">||</span>
     <span class="ruby-identifier">butwas</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">30</span>         <span class="ruby-operator">||</span>
     <span class="ruby-identifier">expect</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">butwas</span>)        <span class="ruby-operator">&amp;&amp;</span>
    <span class="ruby-constant">Minitest</span><span class="ruby-operator">::</span><span class="ruby-constant">Assertions</span>.<span class="ruby-identifier">diff</span>

  <span class="ruby-identifier">need_to_diff</span> <span class="ruby-operator">&amp;&amp;</span> [<span class="ruby-identifier">expect</span>, <span class="ruby-identifier">butwas</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

